+Sat Mar 2 21:28:03 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk-pixbuf.c (gdk_pixbuf_new): Bullet-proof against integer
+ overflow.
+
2002-03-03 Tor Lillqvist <tml@iki.fi>
* gtk-pixbuf.rc.in: Remove.
* gdk-pixdata.c (gdk_pixdata_to_csource): Use {} not
() to group around string assigned to char[]. (#72767,
- Tomas Ögren)
+ Tomas Ã\83Â\96gren)
2002-02-21 Havoc Pennington <hp@pobox.com>
2000-06-05 Mathieu Lacage <mathieu@gnome.org>
* configure.in: add some gtk parameters to the
- GDK_PIXBUF_LIB²S and GDK_PIXBUG_INCLUDEDIR vars. One more
+ GDK_PIXBUF_LIB²S and GDK_PIXBUG_INCLUDEDIR vars. One more
fight in my crusade for strange prefix compile...
2000-05-30 Not Zed <NotZed@HelixCode.com>
* gdk-pixbuf/Makefile.am (INCLUDES): Add $(GNOME_CFLAGS).
Reported by Jens Finke.
-2000-04-14 Tomasz K³opczko <kloczek@pld.org.pl>
+2000-04-14 Tomasz K³opczko <kloczek@pld.org.pl>
* gdk-pixbuf/pixops/makefile.am: $(LIBART_CFLAGS) replaced by
$(GTK_CFLAGS) - now gdk-pixbuf compiles correctly.
guchar *buf;
int channels;
int rowstride;
+ gsize bytes;
g_return_val_if_fail (colorspace == GDK_COLORSPACE_RGB, NULL);
g_return_val_if_fail (bits_per_sample == 8, NULL);
g_return_val_if_fail (width > 0, NULL);
g_return_val_if_fail (height > 0, NULL);
- /* Always align rows to 32-bit boundaries */
+ if (width <= 0 || height <= 0)
+ return NULL;
channels = has_alpha ? 4 : 3;
- rowstride = 4 * ((channels * width + 3) / 4);
+ rowstride = width * channels;
+ if (rowstride / channels != width || rowstride + 3 < 0) /* overflow */
+ return NULL;
+
+ /* Always align rows to 32-bit boundaries */
+ rowstride = (rowstride + 3) & ~3;
- buf = g_try_malloc (height * rowstride);
+ bytes = height * rowstride;
+ if (bytes / rowstride != height) /* overflow */
+ return NULL;
+
+ buf = g_try_malloc (bytes);
if (!buf)
return NULL;